package test.util;

import zhengqc.search.Search;

public class SearchHelper {
    public static <E extends Comparable<E>> void searchTest(Search searchObject, E[] data, E target) {
        long startTime = System.nanoTime();
        int index = searchObject.search(data, target);
        long endTime = System.nanoTime();
        double time = (endTime - startTime) / 1e9;

        System.out.printf("%s,\tn = %d,\ttime: %fs,\tindex = %d\n", searchObject.searchName, data.length, time, index);
    }
}
